#!/bin/sh

# Slackware build script for leocad_pieces, the pieces library needed by
# LeoCAD

# Written by Niels Horn - niels.horn@gmail.com
# revision date 2010/07/17

PRGNAM=leocad_pieces
VERSION=${VERSION:-3934}
ARCH=noarch
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $PKG $OUTPUT

# Data from zip-file + set permissions
mkdir -p $PKG/usr/share/leocad
unzip $CWD/pieces-$VERSION.zip -d $PKG/usr/share/leocad
chown -R root:root $PKG
find $PKG -type f -exec chmod 644 {} \;

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
